﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.Z.Inventory.Domain
{
    [Table("货品表")]
    public class T_Goods:BasicData
    {
        //GoodsName货品名称
        public string GoodsName { get; set; }
        //GoodsNumber货品单号 
        public string GoodsNumber { get; set; }
        //GoodsModel规格
        public string GoodsModel { get; set; }
        //GoodsUnit单位
        public string GoodsUnit { get; set; }
        //SystemNum系统存储数量
        public int? SystemNum { get; set; }
        //ActualNum实际存储数量
        public int? ActualNum { get; set; }
        //DifferentCount差异数量
        public int? DifferentCount { get; set; }
        /// <summary>
        /// 单价
        /// </summary>
        public decimal OnePrice { get; set; }
        public int? MinStockLevel { get; set; }     // 最低库存阈值
        public int? SafeStockLevel { get; set; }    // 安全库存阈值
        public int? MaxStockLevel { get; set; }     // 最大库存阈值

        // 计算属性（不映射到数据库）
        [NotMapped]
        public decimal TotalValue => (SystemNum ?? 0) * OnePrice;

        [NotMapped]
        public bool IsLowStock => SystemNum <= MinStockLevel;

        [NotMapped]
        public bool IsOutOfStock => SystemNum <= 0;
    }
}
